using System;
using System.Data.Entity.ModelConfiguration;
using System.Data.Common;
using System.Data.Entity;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using DomainLayer.Data.Entities;

namespace Infrastructure.Data.Mapping
{
	public class FMS_RuleMap : EntityTypeConfiguration<FMS_Rule>
	{
		public FMS_RuleMap()
		{
			// Primary Key
			this.HasKey(t => t.ID);

			// Properties
			this.Property(t => t.Name)
				.IsRequired()
				.HasMaxLength(50);
				
			this.Property(t => t.UIPath)
				.HasMaxLength(100);
				
			this.Property(t => t.RuleClassName)
				.IsRequired()
				.HasMaxLength(50);
				
			this.Property(t => t.ResolveClassName)
				.HasMaxLength(50);
				
			this.Property(t => t.Description)
				.HasMaxLength(200);
				
			// Table & Column Mappings
			this.ToTable("FMS_Rule");
			this.Property(t => t.ID).HasColumnName("ID");
			this.Property(t => t.Name).HasColumnName("Name");
			this.Property(t => t.UIPath).HasColumnName("UIPath");
			this.Property(t => t.RuleClassName).HasColumnName("RuleClassName");
			this.Property(t => t.ResolveClassName).HasColumnName("ResolveClassName");
			this.Property(t => t.Description).HasColumnName("Description");
		}
	}
}

